package com.yh.correct.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.yh.correct.dao.ISysLogMapper;
import com.yh.correct.model.SysLog;
import com.yh.correct.service.ISysLogService;

/**
 * 系统日志service层实现类
 * @author Administrator
 *
 */
@Service
public class SysLogServiceImpl implements ISysLogService{
	
	/**
	 * 系统日志dao层接口
	 */
	@Autowired
	private ISysLogMapper logMapper;

	/**
	 * 获取系统日志
	 */
	@Override
	public SysLog getSysLog(SysLog log) throws Exception {
		// TODO Auto-generated method stub
		return logMapper.getSysLog(log);
	}
	/**
	 * 插入系统日志
	 */
	@Override
	public int insertSysLog(SysLog log) throws Exception {
		// TODO Auto-generated method stub
		return logMapper.insertSysLog(log);
	}
	/**
	 * 删除系统日志(主键)
	 */
	@Override
	public int deleteSysLog(SysLog log) throws Exception {
		// TODO Auto-generated method stub
		return logMapper.deleteSysLog(log);
	}
	/**
	 * 通过用户名删除系统日志
	 */
	@Override
	public int deleteSysLogByUserId(String username) throws Exception {
		// TODO Auto-generated method stub
		return logMapper.deleteSysLogByUserId(username);
	}
	/**
	 * 动态条件查询系统日志分页
	 */
	@Override
	public PageInfo<Object> findListByCondition(Map<String, Object> condition) throws Exception {
		// TODO Auto-generated method stub
		PageHelper.startPage((int)condition.get("pageNum"), (int)condition.get("pageSize"));
		PageInfo<Object> pageInfo=new PageInfo<Object>(logMapper.findListByCondition(condition));
		return pageInfo;
	}
	/**
	 * 查询所有的系统日志
	 */
	@Override
	public List<Map<String,Object>> findListAll() throws Exception {
		// TODO Auto-generated method stub
		return logMapper.findListAll();
	}

}
